import {tplReplace,filterData} from '../utils/tool'
import courseItemTpl from '../templates/courseItem.tpl'
import {URL} from '../config/config'
export default($)=>{
    const $navList = $('.J_navList'),
          $courseList = $('.J_courseList'),
          $navItems = $navList.children('.nav-item'),
          courseData = $.parseJSON($('#J_courseData').html());
    const init = () =>{
        bindEvent();
    }      
    function bindEvent(){
        $navList.on('click','.nav-lk',onNavClick)
    }
    function onNavClick(){
        const $this = this,
              curIdx = $this.parent().index(),
              id = parseInt($this.attr('data-id')),
              data = filterData(courseData,id);
        tabChange(curIdx);
        renderList(data);      
    }
}